import { createRouter, createWebHistory } from "vue-router";
const routes = [
  {
    path: '',
    redirect: '/userlogin'
  },
  //主页 
  {
    path: '/homeofone',
    name: '商城主页',
    component: () => import('@/views/homeofone/homeofone.vue'),
    children: [
      { path: 'homeshow', name: '展示主页', component: () => import('@/views/homeofone/showhome.vue') },
      { path: 'buy', name: '商品', component: () => import('@/views/homeofone/buy.vue') },
    ]
  },
  {
    path: '/userlogin',
    name: '用户注册',
    component: () => import('@/views/homeofone/buyUserLogin.vue')
  },
  //后台
  {
    path: '/manner',
    component: () => import('@/views/manner.vue'),
    name: '首页',
    children: [
      { path: 'userdata', name: '主页', component: () => import('@/views/userdata/userdata.vue') },
      { path: 'home', name: '用户数据', component: () => import('@/views/home/home.vue') },
      { path: 'userself', name: '个人中心', component: () => import('@/views/userself/userself.vue') },
      { path: 'gl', name: '管理员数据', component: () => import('@/views/gl/gl.vue') },
      { path: 'map', name: '地图', component: () => import('@/views/map/map.vue') },
    ]
  },
  {
    path: '/login',
    name: '登录',
    component: () => import('@/views/login.vue'),
  },
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
});

export default router;